Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve coverage on OSAL unit tests #268

Merged
merged 3 commits into from
Nov 7, 2019

Conversation

jphickey
Copy link
Contributor

Describe the contribution
Fixes issue #230, improving coverage of shared and vxworks modules in the OSAL coverage tests.

Testing performed

  1. Build coverage using:
cmake -DCMAKE_BUILD_TYPE=debug -DOSALCOVERAGE_TARGET_OSTYPE='shared;vxworks' -DOSAL_INCLUDEDIR=$CONFIG_DIR $OSAL_DIR/src/unit-test-coverage
  1. Make and execute all unit tests for shared and vxworks implementations.
  2. Run "lcov" to collect results:
lcov --capture -d $BUILDDIR/shared -d $BUILDDIR/vxworks --output-file $BUILDDIR/coverage.info
  1. Examine coverage results (use genhtml to convert to html format):
genhtml $BUILDDIR/coverage.info --output-directory $BUILDDIR/out

Expected behavior changes
Code coverage is substantially improved. All non-deprecated lines are visited.

Before change:

  lines......: 90.4% (2549 of 2820 lines)
  functions..: 95.9% (306 of 319 functions)

After change:

  lines......: 99.9% (2846 of 2849 lines)
  functions..: 100.0% (330 of 330 functions)

System(s) tested on:
Ubuntu 18.04.2 LTS, 64 bit

Additional context
This fixes one very minor FSW code issue found while running UT. The return value of the vxWorks "taskSpawn" is documented to be ERROR, not zero, in the event of failure. The FSW was testing the wrong value here in one instance.

The only non-covered lines of FSW code are in 2 deprecated directory functions.

Contributor Info
Joseph Hickey, Vantage Systems, Inc.

Rename to "vxworks" and "posix", respectively, to match the
actual implementation names.  The build scripts rely on
the name being the same and will fail if different.

This also updates the default build to be vxworks rather
than vxworks6, if not specified on the command line.
@jphickey jphickey requested a review from skliper October 21, 2019 16:21
Copy link
Contributor

@skliper skliper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate FSW change. Prefer a separate commit at minimum. Ideally create an issue, fix, and pull specific to the FSW change (easier tracking/reporting of FSW changes).

Add numerous unit test cases to improve the code coverage
ratios on the vxworks and shared implementation layers.

Prior to this change set, the coverage ratio was:
  lines......: 90.4% (2549 of 2820 lines)
  functions..: 95.9% (306 of 319 functions)

After this change set, the coverage ratio is:
  lines......: 99.9% (2846 of 2849 lines)
  functions..: 100.0% (330 of 330 functions)

Note these stats include some of the UT code itself,
and this is what added 11 functions.  No functions
were added to FSW code.

Note, one test condition will fail until the
fix for related bug nasa#269 is merged.

This also fixes the posix coverage test so it
builds and runs, but coverage is still not
implemented here.
@jphickey
Copy link
Contributor Author

Updated commit dfa3393 removes change to FSW code. Submitted issue #269, pull #270 for that change.

@skliper skliper added CCB:Approved Indicates code review and approval by community CCB enhancement and removed enhancement labels Oct 23, 2019
The timer code for VxWorks was fixed in bug nasa#271 and the
coverage code test needs a corresponding update to cover
the code change.

This is kept as a separate update commit as neither
changeset is merged to master yet.
@jphickey
Copy link
Contributor Author

FYI: just pushed an additional commit on this branch that correlates with pull #277 (FSW code changes here required a corresponding coverage update).

Kept as a separate commit because neither pull request is merged to master yet. Inclusion depends on order of merges.

skliper added a commit that referenced this pull request Oct 31, 2019
Fixes #230 #266 #269
Code reviewed and approved at 20191023 CCB
@skliper skliper merged commit 5cdd403 into nasa:master Nov 7, 2019
@jphickey jphickey deleted the fix-230-improve-coverage branch December 9, 2019 15:08
@skliper skliper added this to the 5.1.0 milestone Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants